package ts.group.webapp.market.common.core.util;

import java.io.FileInputStream;
import java.util.Properties;

/**
 * 读取配置文件信息
 * @author Jackson
 *
 */
public class ConfigHolder {
	private static final String CONFIG_FILE_NAME = "param.properties";

	private static String configPath = null;

	private static Properties prop  ;
	static {
		if (configPath == null) {
			configPath = Thread.currentThread().getContextClassLoader()
					.getResource("").getPath();
		}
		String path = configPath + CONFIG_FILE_NAME;
		prop = new Properties();
		try {
			prop.load(new FileInputStream(java.net.URLDecoder.decode(path,"utf-8")));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static String getProperties(String key){
		if (!prop.isEmpty()) {
			return prop.getProperty(key);	
		}
		return null;
	}
	
}
